<script type="text/javascript">
/*-----------------------------------------------------------
Onload
-----------------------------------------------------------*/
/*-----------------------------------------------------------
Events
-----------------------------------------------------------*/
$('.btn-cancel').click(function(){
    window.location = '<?php echo $this->createUrl('index'); ?>';
})

$('#btn-refresh').click(function(){
    var url = '<?php echo $this->createUrl('clearState') ?>';
    $.post(url, '', function(){
        window.location = "<?php echo $this->createUrl('index'); ?>";
    });
})

$('#btn-reset').click(function(){
    window.location.reload();
})

$('#btn-search').click(function(){
    $('#search-box').toggleClass('hidden');
    $('#search-box').slideToggle();
})

$('#btn-submit').click(function(){
    url = '<?php echo $this->createUrl('index'); ?>' 
        + '?' + $('#search-form').serialize();
    $.fn.yiiGridView.update('album-grid', {
        url: url
    });
})

/*-----------------------------------------------------------
Functions
-----------------------------------------------------------*/
function updateGridview()
{
    $.fn.yiiGridView.update('album-grid');
}
</script>
